package alex.deploy.constant;

/**
 * Created by lushun.chen on 2017/4/26.
 *
 * @author lushun.chen
 */
public enum DeployStatus {

    CREATE(0, "创建"),
    PULL(10, "拉代码"),
    BUILD_DOCKER_IMAGE(20, "构建docker镜像"),
    COMPILE(21, "编译"),
    PACKAGE(22, "打包"),
    DEPLOY(30, "部署"),
    COMPLETE(50, "完成");

    private int value;
    private String name;

    DeployStatus(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // 普通方法
    public static String getName(int value) {
        for (DeployStatus c : DeployStatus.values()) {
            if (c.getValue() == value) {
                return c.name;
            }
        }
        return null;
    }
}
